//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _PRIMITIVES_H
#define _PRIMITIVES_H
//
#include <global.h>
#include <QSharedPointer>
#include <QString>
#include <common/id.h>
#include <model/particletemplate.h>
#include <model/emittertemplate.h>
#include <model/randomdouble.h>
#include <model/randomcolor.h>
#include <model/randomposition.h>
#include "primitive.h"
#include "modeldataobjectadapter.h"
//
namespace Primitives
{
//
class RemoveObjectFromContainment
{
public:
   typedef QPair<Id,int> SavedParentPair;
   typedef QList<SavedParentPair> SavedParentType;
   UiError initialize(Id id,Document *p_doc);
   UiError exec_impl(Id id,Document *p_doc);
   UiError undo_impl(Id id,Document *p_doc);
   void store_data_impl(QDataStream &p_stream) const;
   void restore_data_impl(RestoreStream &p_stream);
private:
   SavedParentType saved_children;
   SavedParentType saved_parents;
//data access
public:
   const SavedParentType &get_children_data() const
      {return saved_children;}
   const SavedParentType &get_parents_data() const
      {return saved_parents;}
};
//
class Reset:public Primitive
{
public:
   static void exec_reset(Document *p_doc);
protected:
   Reset();
   virtual UiError exec_impl(Document *p_doc){return UiError();}
   virtual UiError undo_impl(Document *p_doc){return UiError();}
   virtual void store_data_impl(QDataStream &p_stream) const{;}
   virtual void restore_data_impl(RestoreStream &p_stream){;}
};
//
class InsertContainment:public Primitive
{
public:
   InsertContainment();
   InsertContainment(const Document *p_doc,Identified *p_parent,int p_parent_position,Identified *p_child,int p_child_position);
   ~InsertContainment();
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   Id parent_id,child_id;
   int parent_position,child_position;
//data access
public:
   Id get_parent_id() const
      {return parent_id;}
   int get_parent_position() const
      {return parent_position;}
   Id get_child_id() const
      {return child_id;}
   int get_child_position() const
      {return child_position;}
};
//
class RemoveContainment:public Primitive
{
public:
   RemoveContainment();
   RemoveContainment(const Document *p_doc,Identified *p_parent,Identified *p_child);
   ~RemoveContainment();
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   Id parent_id,child_id;
   int parent_position,child_position;
//data access
public:
   Id get_parent_id() const
      {return parent_id;}
   int get_parent_position() const
      {return parent_position;}
   Id get_child_id() const
      {return child_id;}
   int get_child_position() const
      {return child_position;}
};
//
class MoveChild:public Primitive
{
public:
   MoveChild();
   MoveChild(const Document *p_doc,Identified *p_parent,int p_old_position,int p_new_position);
   ~MoveChild();
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   Id parent_id;
   int old_position,new_position;
//data access
public:
   Id get_parent_id() const
      {return parent_id;}
   int get_old_position() const
      {return old_position;}
   int get_new_position() const
      {return new_position;}
};
//
class NewDataObject:public Primitive
{
public:
   NewDataObject(ModelDataObjectAdapter &p_adapter);
   NewDataObject(ModelDataObjectAdapter &p_adapter,const Document *p_doc,Identified *p_parent=0,int p_position=-1);
   ~NewDataObject();
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   ModelDataObjectAdapter &adapter;
   Id new_object_id;
   Id new_parent_id;
   int new_position;
   QByteArray new_object_data;
//data access
public:
   const ModelDataObjectAdapter &get_adapter() const
      {return adapter;}
   Identified *get_new_object(Document *p_doc) const;
   Id get_new_object_id() const
      {return new_object_id;}
   Id get_new_parent_id() const
      {return new_parent_id;}
   int get_new_position() const
      {return new_position;}
};
//
class DelDataObject:public Primitive
{
public:
   DelDataObject(ModelDataObjectAdapter &p_adapter);
   DelDataObject(ModelDataObjectAdapter &p_adapter,const Document *p_doc,Identified *p_object);
   ~DelDataObject();
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   ModelDataObjectAdapter &adapter;
   Id old_object_id;
   QByteArray old_object_data;
   RemoveObjectFromContainment remove_from_containment;
//data access
public:
   const ModelDataObjectAdapter &get_adapter() const
      {return adapter;}
   Id get_old_object_id() const
      {return old_object_id;}
   const RemoveObjectFromContainment &get_remove_data() const
      {return remove_from_containment;}
};
//
class SetDataObjectName:public Primitive
{
public:
   SetDataObjectName(ModelDataObjectAdapter &p_adapter);
   SetDataObjectName(ModelDataObjectAdapter &p_adapter,const Document *p_doc,Identified *p_object,QString p_new_name);
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   ModelDataObjectAdapter &adapter;
   Id object_id;
   QString old_name,new_name;
//data acces
public:
   const ModelDataObjectAdapter &get_adapter() const
      {return adapter;}
   Id get_object_id() const
      {return object_id;}
   QString get_old_name() const
      {return old_name;}
   QString get_new_name() const
      {return new_name;}
};
//
class RemoveParticleTemplate:public Primitive
{
public:
   RemoveParticleTemplate();
   RemoveParticleTemplate(const Document *p_doc,model::ParticleTemplate *p_particle_template);
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
   ~RemoveParticleTemplate();
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   struct ReferenceAtEmitter
   {
      Id emitter_id;
      int emitter_block_index;
      ReferenceAtEmitter(Id id,int ix):emitter_id(id),emitter_block_index(ix){;}
   };
   Id pt_id;
   QList<ReferenceAtEmitter> references_emitter;
   UiError set_references(Document *p_doc,model::ParticleTemplate *p_pt);
};
//
class RemoveEmitterTemplate:public Primitive
{
public:
   RemoveEmitterTemplate();
   RemoveEmitterTemplate(const Document *p_doc,model::EmitterTemplate *p_emitter_template);
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
   ~RemoveEmitterTemplate();
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   struct ReferenceAtEmitter
   {
      Id emitter_id;
      int emitter_block_index;
      ReferenceAtEmitter(Id id,int ix):emitter_id(id),emitter_block_index(ix){;}
   };
   struct ReferenceAtParticle
   {
      Id particle_id;
      int emitter_index;
      ReferenceAtParticle(Id id,int ix):particle_id(id),emitter_index(ix){;}
   };
   Id et_id;
   QList<ReferenceAtEmitter> references_emitter;
   QList<ReferenceAtParticle> references_particle;
   UiError set_references(Document *p_doc,model::EmitterTemplate *p_et);
};
//
class PTPrimitiveDelegate:public PrimitiveDelegate
{
public:
   PTPrimitiveDelegate(unsigned int p_type);
   virtual UiError exec_impl(Document *p_doc,model::ParticleTemplate *p_pt,Primitive *p_parent)=0;
   virtual UiError undo_impl(Document *p_doc,model::ParticleTemplate *p_pt,Primitive *p_parent)=0;
};
//
class SelectPT:public Primitive
{
public:
   SelectPT(const Document *p_doc,model::ParticleTemplate *p_pt,PTPrimitiveDelegate *p_delegate);
   ~SelectPT();
   static Primitive *create(unsigned int p_type,RestoreStream &p_stream);
private:
   SelectPT(PTPrimitiveDelegate *p_delegate);
protected:
   virtual UiError exec_impl(Document *p_doc);
   virtual UiError undo_impl(Document *p_doc);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   Id pt_id;
   PTPrimitiveDelegate *deleg;
//data access
public:
   Id get_pt_id() const
      {return pt_id;}
   const PTPrimitiveDelegate &get_delegate() const
      {return *deleg;}
};
//
class SetPTVisible:public PTPrimitiveDelegate
{
public:
   SetPTVisible(bool p_new_visible);
   static PrimitiveDelegate *create(unsigned int p_type,RestoreStream &p_stream);
private:
   SetPTVisible();
protected:
   virtual UiError exec_impl(Document *p_doc,model::ParticleTemplate *p_pt,Primitive *p_parent);
   virtual UiError undo_impl(Document *p_doc,model::ParticleTemplate *p_pt,Primitive *p_parent);
   virtual void store_data_impl(QDataStream &p_stream) const;
   virtual void restore_data_impl(RestoreStream &p_stream);
private:
   bool value;
public:
   bool get_other_value() const
      {return value;}
};
//
class SetPTLifeTime : public PTPrimitiveDelegate {
public:
   SetPTLifeTime(model::RandomDouble p_new_life_time);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTLifeTime();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomDouble value;
};
//
class SetPTDensity : public PTPrimitiveDelegate {
public:
   SetPTDensity(float p_new_density);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTDensity();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   float value;
};
//
class SetPTGravitationEnabled : public PTPrimitiveDelegate {
public:
   SetPTGravitationEnabled(bool p_new_gravitation_enabled);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTGravitationEnabled();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   bool value;
};
//
class SetPTFrictionEnabled : public PTPrimitiveDelegate {
public:
   SetPTFrictionEnabled(bool p_new_friction_enabled);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTFrictionEnabled();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   bool value;
};
//
class SetPTShape : public PTPrimitiveDelegate {
public:
   SetPTShape(model::ParticleTemplate::Shape p_new_shape);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTShape();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::Shape value;
};
//
class SetPTTextureFile : public PTPrimitiveDelegate {
public:
   SetPTTextureFile(QString p_new_texture_file);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTTextureFile();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QString value;
};
//
class SetPTTileS : public PTPrimitiveDelegate {
public:
   SetPTTileS(unsigned int p_new_tile_s);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTTileS();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   unsigned int value;
};
//
class SetPTTileT : public PTPrimitiveDelegate {
public:
   SetPTTileT(unsigned int p_new_tile_t);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTTileT();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   unsigned int value;
};
//
class SetPTNumTiles : public PTPrimitiveDelegate {
public:
   SetPTNumTiles(float p_new_num_tiles);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTNumTiles();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   float value;
};
//
class SetPTTileSpeedMode : public PTPrimitiveDelegate {
public:
   SetPTTileSpeedMode(model::ParticleTemplate::TileSpeedMode p_new_tile_speed_mode);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   SetPTTileSpeedMode();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::TileSpeedMode value;
};
//
class PTNewTimeMark : public PTPrimitiveDelegate {
public:
   PTNewTimeMark(QString p_name);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
   const QString &get_time_mark_name() const
      {return time_mark_name;}
private:
   PTNewTimeMark();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::TimeMark new_time_mark;
   QString time_mark_name;
};
//
class PTRemTimeMark : public PTPrimitiveDelegate {
public:
   PTRemTimeMark(QString p_name);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
   const QString &get_time_mark_name() const
      {return time_mark_name;}
private:
   PTRemTimeMark();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::TimeMark removed_time_mark;
   QString time_mark_name;
};
//
class PTRenameTimeMark : public PTPrimitiveDelegate {
public:
   PTRenameTimeMark(QString p_current_name, QString p_other_name);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
   const QString &get_current_name() const
      {return current_name;}
   const QString &get_other_name() const
      {return other_name;}
private:
   PTRenameTimeMark();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QString current_name, other_name;
   void replace_names(model::ParticleTemplate *pt, QString from, QString to);
};
//
class PTChangeTimeMark : public PTPrimitiveDelegate {
public:
   PTChangeTimeMark(QString p_name, const model::ParticleTemplate::TimeMark &p_new_tmark);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
   const QString &get_name() const
      {return name;}
   const model::ParticleTemplate::TimeMark &get_value() const
      {return value;}
private:
   PTChangeTimeMark();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QString name;
   model::ParticleTemplate::TimeMark value;
};
//
class PTNewEB : public PTPrimitiveDelegate {
public:
   PTNewEB(QString p_name);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTNewEB();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::EmitterBlock new_eb;
};
//
class PTRemEB : public PTPrimitiveDelegate {
public:
   PTRemEB(int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTRemEB();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::EmitterBlock old_eb;
   int eb_index;
};
//
class PTEBPrimitiveDelegate : public PrimitiveDelegate {
public:
   PTEBPrimitiveDelegate(unsigned int type);
   virtual UiError exec_impl(Document *p_doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent) = 0;
   virtual UiError undo_impl(Document *p_doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent) = 0;
};
//
class SelectPTEB : public Primitive {
public:
   SelectPTEB(const Document *p_doc, model::ParticleTemplate *p_pt, int p_eb_index, PTEBPrimitiveDelegate *p_delegate);
   ~SelectPTEB();
   static Primitive *create(unsigned int type, RestoreStream &p_stream);
private:
   SelectPTEB(PTEBPrimitiveDelegate *p_delegate);
protected:
   virtual UiError exec_impl(Document *doc);
   virtual UiError undo_impl(Document *doc);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream);
private:
   Id pt_id;
   int eb_index;
   PTEBPrimitiveDelegate *deleg;
};
//
class PTSetEBName : public PTEBPrimitiveDelegate {
public:
   PTSetEBName(QString p_name);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetEBName();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QString eb_name;
};
//
class PTSetEBEmitter : public PTEBPrimitiveDelegate {
public:
   PTSetEBEmitter(model::EmitterTemplate *p_emitter);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetEBEmitter();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   Id et_id;
};
//
class PTSetEBTime1 : public PTEBPrimitiveDelegate {
public:
   PTSetEBTime1(QString p_time1);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetEBTime1();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QString time1;
};
//
class PTSetEBTime2 : public PTEBPrimitiveDelegate {
public:
   PTSetEBTime2(QString p_time2);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetEBTime2();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QString time2;
};
//
class PTSetEBIntervalMin : public PTEBPrimitiveDelegate {
public:
   PTSetEBIntervalMin(double imin);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetEBIntervalMin();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   double interval_min;
};
//
class PTSetEBIntervalMax : public PTEBPrimitiveDelegate {
public:
   PTSetEBIntervalMax(double imax);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetEBIntervalMax();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, model::ParticleTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   double interval_max;
};
//
class PTColorCPSetConst : public PTPrimitiveDelegate {
public:
   PTColorCPSetConst(const model::RandomColor &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTColorCPSetConst();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::ColorControlPoint> old_points;
   model::RandomColor new_value;
};
//
class PTColorCPSetLine : public PTPrimitiveDelegate {
public:
   PTColorCPSetLine(const model::RandomColor &p_value_start, const model::RandomColor &p_value_end);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTColorCPSetLine();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::ColorControlPoint> old_points;
   model::RandomColor new_value_start, new_value_end;
};
//
class PTNewColorCP : public PTPrimitiveDelegate {
public:
   PTNewColorCP(const model::ParticleTemplate::ColorControlPoint &p_new_cp, int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTNewColorCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::ColorControlPoint new_cp;
   int cp_index;
};
//
class PTRemColorCP : public PTPrimitiveDelegate {
public:
   PTRemColorCP(int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTRemColorCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::ColorControlPoint old_cp;
   int cp_index;
};
//
class PTSetColorCPValue : public PTPrimitiveDelegate {
public:
   PTSetColorCPValue(int p_index, const model::RandomColor &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetColorCPValue();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomColor value;
   int cp_index;
};
//
class PTAlphaCPSetConst : public PTPrimitiveDelegate {
public:
   PTAlphaCPSetConst(const model::RandomDouble &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTAlphaCPSetConst();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::FloatControlPoint> old_points;
   model::RandomDouble new_value;
};
//
class PTAlphaCPSetLine : public PTPrimitiveDelegate {
public:
   PTAlphaCPSetLine(const model::RandomDouble &p_value_start, const model::RandomDouble &p_value_end);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTAlphaCPSetLine();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::FloatControlPoint> old_points;
   model::RandomDouble new_value_start, new_value_end;
};
//
class PTNewAlphaCP : public PTPrimitiveDelegate {
public:
   PTNewAlphaCP(const model::ParticleTemplate::FloatControlPoint &p_new_cp, int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTNewAlphaCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::FloatControlPoint new_cp;
   int cp_index;
};
//
class PTRemAlphaCP : public PTPrimitiveDelegate {
public:
   PTRemAlphaCP(int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTRemAlphaCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::FloatControlPoint old_cp;
   int cp_index;
};
//
class PTSetAlphaCPValue : public PTPrimitiveDelegate {
public:
   PTSetAlphaCPValue(int p_index, const model::RandomDouble &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetAlphaCPValue();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomDouble value;
   int cp_index;
};
//
class PTSizeCPSetConst : public PTPrimitiveDelegate {
public:
   PTSizeCPSetConst(const model::RandomDouble &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSizeCPSetConst();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::FloatControlPoint> old_points;
   model::RandomDouble new_value;
};
//
class PTSizeCPSetLine : public PTPrimitiveDelegate {
public:
   PTSizeCPSetLine(const model::RandomDouble &p_value_start, const model::RandomDouble &p_value_end);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSizeCPSetLine();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::FloatControlPoint> old_points;
   model::RandomDouble new_value_start, new_value_end;
};
//
class PTNewSizeCP : public PTPrimitiveDelegate {
public:
   PTNewSizeCP(const model::ParticleTemplate::FloatControlPoint &p_new_cp, int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTNewSizeCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::FloatControlPoint new_cp;
   int cp_index;
};
//
class PTRemSizeCP : public PTPrimitiveDelegate {
public:
   PTRemSizeCP(int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTRemSizeCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::FloatControlPoint old_cp;
   int cp_index;
};
//
class PTSetSizeCPValue : public PTPrimitiveDelegate {
public:
   PTSetSizeCPValue(int p_index, const model::RandomDouble &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetSizeCPValue();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomDouble value;
   int cp_index;
};
//
class PTRadiusCPSetConst : public PTPrimitiveDelegate {
public:
   PTRadiusCPSetConst(const model::RandomDouble &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTRadiusCPSetConst();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::FloatControlPoint> old_points;
   model::RandomDouble new_value;
};
//
class PTRadiusCPSetLine : public PTPrimitiveDelegate {
public:
   PTRadiusCPSetLine(const model::RandomDouble &p_value_start, const model::RandomDouble &p_value_end);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTRadiusCPSetLine();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QList<model::ParticleTemplate::FloatControlPoint> old_points;
   model::RandomDouble new_value_start, new_value_end;
};
//
class PTNewRadiusCP : public PTPrimitiveDelegate {
public:
   PTNewRadiusCP(const model::ParticleTemplate::FloatControlPoint &p_new_cp, int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTNewRadiusCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::FloatControlPoint new_cp;
   int cp_index;
};
//
class PTRemRadiusCP : public PTPrimitiveDelegate {
public:
   PTRemRadiusCP(int p_index);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTRemRadiusCP();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::ParticleTemplate::FloatControlPoint old_cp;
   int cp_index;
};
//
class PTSetRadiusCPValue : public PTPrimitiveDelegate {
public:
   PTSetRadiusCPValue(int p_index, const model::RandomDouble &p_value);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   PTSetRadiusCPValue();
protected:
   virtual UiError exec_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::ParticleTemplate *p_pt, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomDouble value;
   int cp_index;
};
//
class ETEBPrimitiveDelegate : public PrimitiveDelegate {
public:
   ETEBPrimitiveDelegate(unsigned int type);
   virtual UiError exec_impl(Document *p_doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent) = 0;
   virtual UiError undo_impl(Document *p_doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent) = 0;
};
//
class SelectETEB : public Primitive {
public:
   SelectETEB(const Document *p_doc, model::EmitterTemplate *p_et, int p_eb_index, ETEBPrimitiveDelegate *p_delegate);
   ~SelectETEB();
   static Primitive *create(unsigned int type, RestoreStream &p_stream);
private:
   SelectETEB(ETEBPrimitiveDelegate *p_delegate);
protected:
   virtual UiError exec_impl(Document *doc);
   virtual UiError undo_impl(Document *doc);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream);
private:
   Id et_id;
   int eb_index;
   ETEBPrimitiveDelegate *deleg;
};
//
class ETSetEBName : public ETEBPrimitiveDelegate {
public:
   ETSetEBName(QString p_name);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBName();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   QString eb_name;
};
//
class ETSetEBAmount : public ETEBPrimitiveDelegate {
public:
   ETSetEBAmount(unsigned int p_amount);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBAmount();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   unsigned int amount;
};
//
class ETSetEBScale : public ETEBPrimitiveDelegate {
public:
   ETSetEBScale(const model::RandomDouble &p_scale);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBScale();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomDouble scale;
};
//
class ETSetEBSynchronized : public ETEBPrimitiveDelegate {
public:
   ETSetEBSynchronized(bool p_synchronized);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBSynchronized();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   bool synchronized;
};
//
class ETSetEBPosition : public ETEBPrimitiveDelegate {
public:
   ETSetEBPosition(const model::RandomPosition &p_position);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBPosition();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomPosition position;
};
//
class ETSetEBAngle : public ETEBPrimitiveDelegate {
public:
   ETSetEBAngle(const model::RandomPosition &p_angle);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBAngle();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomPosition angle;
};
//
class ETSetEBAngularVelocity : public ETEBPrimitiveDelegate {
public:
   ETSetEBAngularVelocity(const model::RandomPosition &p_angular_velocity);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBAngularVelocity();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   model::RandomPosition angular_velocity;
};
//
class ETSetEBParticle : public ETEBPrimitiveDelegate {
public:
   ETSetEBParticle(model::ParticleTemplate *p_particle);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBParticle();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   Id particle_id;
};
//
class ETSetEBEmitter : public ETEBPrimitiveDelegate {
public:
   ETSetEBEmitter(model::EmitterTemplate *p_emitter);
   static PrimitiveDelegate *create(unsigned int type, RestoreStream &p_stream);
private:
   ETSetEBEmitter();
protected:
   virtual UiError exec_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual UiError undo_impl(Document *doc, model::EmitterTemplate *p_et, model::EmitterTemplate::EmitterBlock &p_eb, Primitive *p_parent);
   virtual void store_data_impl(QDataStream& p_stream) const;
   virtual void restore_data_impl(RestoreStream& p_stream) ;
private:
   Id emitter_id;
};
//
enum Type {
   type_Reset,
   type_InsertContainment,
   type_RemoveContainment,
   type_MoveChild,
   type_NewDataObject,
   type_DelDataObject,
   type_SetDataObjectName,
   type_RemoveParticleTemplate,
   type_RemoveEmitterTemplate,
   type_SelectPT,
   type_SetPTVisible,
   type_SetPTLifeTime,
   type_SetPTDensity,
   type_SetPTGravitationEnabled,
   type_SetPTFrictionEnabled,
   type_SetPTShape,
   type_SetPTTextureFile,
   type_SetPTTileS,
   type_SetPTTileT,
   type_SetPTNumTiles,
   type_SetPTTileSpeedMode,
   type_PTNewTimeMark,
   type_PTRemTimeMark,
   type_PTRenameTimeMark,
   type_PTChangeTimeMark,
   type_PTNewEB,
   type_PTRemEB,
   type_SelectPTEB,
   type_PTSetEBName,
   type_PTSetEBEmitter,
   type_PTSetEBTime1,
   type_PTSetEBTime2,
   type_PTSetEBIntervalMin,
   type_PTSetEBIntervalMax,
   type_PTColorCPSetConst,
   type_PTColorCPSetLine,
   type_PTNewColorCP,
   type_PTRemColorCP,
   type_PTSetColorCPValue,
   type_PTAlphaCPSetConst,
   type_PTAlphaCPSetLine,
   type_PTNewAlphaCP,
   type_PTRemAlphaCP,
   type_PTSetAlphaCPValue,
   type_PTSizeCPSetConst,
   type_PTSizeCPSetLine,
   type_PTNewSizeCP,
   type_PTRemSizeCP,
   type_PTSetSizeCPValue,
   type_PTRadiusCPSetConst,
   type_PTRadiusCPSetLine,
   type_PTNewRadiusCP,
   type_PTRemRadiusCP,
   type_PTSetRadiusCPValue,
   type_SelectETEB,
   type_ETSetEBName,
   type_ETSetEBAmount,
   type_ETSetEBScale,
   type_ETSetEBSynchronized,
   type_ETSetEBPosition,
   type_ETSetEBAngle,
   type_ETSetEBAngularVelocity,
   type_ETSetEBParticle,
   type_ETSetEBEmitter
};
//enum DelegateType {
//   type_PTPrimitiveDelegate
//};
}
#endif
